#include<bits/stdc++.h>
using namespace std;
int m[100005];
int a[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,cnt=0,f=1,maxr=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        maxr=max(maxr,a[i]);
        m[a[i]]++;
    }
    int last=INT_MAX;
    for(int i=1;i<=maxr;i++){
        if(m[i]!=0){
            if(last==INT_MAX){
                last=m[i];
            }else{
                if(last>=m[i]){
                    cnt+=m[i];
                }else{
                    cnt=cnt+last;
                    last=m[i];
                }
            }
        }
    }
    cout<<n-cnt<<endl;
    return 0;
}